<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
  <title>瓜果超市</title>
</head>
<body>
  <div id="app">
    <el-button @click='getCart'>getCart</el-button>
    <el-button @click='setCart'>setCart</el-button>
  </div>
  <script>
    var app = new Vue({
      el: "#app",
      methods: {
        async getCart(page) {
          const ret = await axios.get('/api/cart')
          console.log('ret:', ret.data.data)
        },
        async setCart() {
          const ret = await axios.post(
            '/api/cart', {
              cart:[
                {
                  name:'菠萝',
                  count:1
                }
              ]
            }
          )
        }
      }
    });
  </script>
</body>

</html>